package com.example.controller;

import com.example.domain.Library;
import com.example.dto.LibraryAddDTO;
import com.example.dto.LibraryCloseDTO;
import com.example.service.LibraryService;
import com.example.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName:LibraryController
 * Package:com.example.controller
 * User:HP
 * Date:2025/8/24
 * Time:下午2:01
 * Author 周东汉
 * Version 1.0
 * Description:
 */
@RestController
@RequestMapping("/api/library")
public class LibraryController {
    @Autowired
    private LibraryService libraryService;


    @GetMapping("/all")
    public Result getLibraries() {
        return libraryService.getLibraries();
    }


    @GetMapping("/rooms")
    public Result getLibraryRooms(@RequestParam Long libraryId) {
        return libraryService.getLibraryRooms(libraryId);
    }

    @GetMapping("/books")
    public Result getLibraryBooks(@RequestParam Long libraryId) {
        return libraryService.getLibraryBooks(libraryId);
    }


    @GetMapping("/bookshelfs")
    public Result getLibraryBookshelfs() {
        return libraryService.getLibraryBookshelfs();
    }

}
